//流程审批设置的回调函数
function appyright(data,dsId,prefix,keyValues){
	$("#cad_S_UBUTN a[code=cad_VERIFY_BUT]").hide(); //审核按钮隐藏
	$("#cad_S_UBUTN a[code=cad_DESTORY_BUT]").hide(); //审核按钮隐藏
	$("#cad_S_UBUTN a[id=cad_sp]").hide();   //删除按钮隐藏
}

//列表界面的回调函数
function initAppList(dsId,prefix,keyValues){
	$("#cad_queryButn a[code=cad_commCopy]").hide();//复制按钮隐藏
	$("#cad_queryButn a[id=cad_mb]").hide();//操作按钮隐藏
	//添加按钮后生成删除按钮
	$("#cad_queryButn a[code=cad_ADD_BUT]").parent().append('<a id="cad_DEL_BUT" class="easyui-linkbutton l-btn" right="" flag="1" dsid="ds_sys_approve_reg1" pre="cad" code="cad_DEL_BUT" sflag="s" oflag="1" onclick="delApproveFlow(this)" iconcls="icon-key"><span class="l-btn-left"><span class="l-btn-text icon-key" style="padding-left: 20px;">删除</span></span></a>');
}


//删除流程审批的设置
function delApproveFlow(){
	//获取选中行
	var selectRow=$("#cad_DATALIST").datagrid("getSelected");
	if(selectRow==null){
		$.messager.alert("删除提示","亲，请先选中一行","info");
		return;
	}
	$.messager.confirm("操作提示", "亲，您确认删除吗？", function (data) {
		if (data){	//确认删除
			var selectIndex=$("#cad_DATALIST").datagrid("getRowIndex",selectRow);
			//获取这一行的主键
			var redId=selectRow["REG_ID"];
			var curLevel=selectRow["APPROVE_LEVEL"];
			var flowId=selectRow["FLOW_ID"];
			$.ajax({
				url:_m_url+'approve/delApproveFlow',   //加载字段
				data:{'regId':redId,'curLevel':curLevel,"flowId":flowId},
				type:'post',
				async:false,
				success:function(data){
					if(data.msg==null||data.msg==""){
						$("#cad_DATALIST").datagrid("deleteRow",selectIndex);
						$.messager.show({title:"保存提示",msg:"o(≧v≦)o~~【亲,删除成功!】",showType:'slide',timeout:2000,showSpeed:400});
					}else{
						$.messager.alert("操作提示",data.msg,"warning");
					}
					
				}
			});
		}
	});
	
}